<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="jt.classic.system.user.IUser"%>
<%@ page import="jt.classic.system.ISystem"%>
<%@ page import="org.limp.mine.StringTool"%>
<%@ page import="org.limp.mine.DateTrimmer"%>
<%@ page import="jt.classic.system.wordbook.XWordbook"%>
<%@ page import="jt.classic.system.wordbook.XWordbookQuery"%>
<%@ page import="jt.classic.app.ldrc.ALdrc"%>
<%@ page import="java.util.List"%>
<%
	String context = jt.classic.system.ISystem.getContextPath();

	IUser user = ISystem.getSessionUser(request);

	ALdrc ldrc = (ALdrc) request.getAttribute("ldrc");

	List list = (List) request.getAttribute("list");

	XWordbookQuery noonquery = (XWordbookQuery) request
			.getAttribute("noonquery");
	XWordbookQuery minutequery = (XWordbookQuery) request
			.getAttribute("minutequery");
	XWordbookQuery hourquery = (XWordbookQuery) request
			.getAttribute("hourquery");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>领导日程查阅</title>
</head>
<jsp:include page="../head.jsp"></jsp:include>
<script>
   function handleAll(){
     var ck = document.getElementsByName("ldid");
     for(var i=0;i<ck.length;i++){
        ck[i].checked = !ck[i].checked;
     }
   }
   
   var sel;
   
   function handleSelect(t){
     sel = t;
     if(t == "dw"){
       var url = context + "/system/tree.do?method=selectgrouptree&type=radio";
       dialog(url,true,"",300,350);
     }else if(t == "pt"){
       var url = context + "/system/tree.do?method=selectuseronly&type=checkbox";
       dialog(url,true,"",300,350);
     }else if(t == "fw"){
       var url = context + "/system/tree.do?method=selectgrouptree&type=checkbox";
       dialog(url,true,"",300,350);
     }
   }
   
   function responseResult(ids,names,types){
      if(sel == "dw"){
         //document.form1.zbdwid.value = ids.replace(/g/g,"");
         document.form1.zbdwname.value = names;
      }else if(sel == "pt"){
         //document.form1.ptryid.value = ids.replace(/g/g,"");
         document.form1.ptry.value = names;
      }else if(sel == "fw"){
         document.form1.fbid.value = ids.replace(/g/g,"");
         document.form1.fbname.value = names;
      }
      
      closeDialog();
   }
   
   function catchHS(but){
      if(but == "stime"){
         document.getElementById("sarea").style.display = "none";
      }else if(but == "etime"){
         document.getElementById("earea").style.display = "none";
      }
   }
   
   function releaseHS(but){
      if(but == "stime"){
         document.getElementById("sarea").style.display = "";
      }else if(but == "etime"){
         document.getElementById("earea").style.display = "";
      }
   }
   
   function handleNoon(thizz){
      if(thizz.name == "snoon" && thizz.value != ""){
         document.getElementById("shour").disabled = true;
         document.getElementById("sminute").disabled = true;
      }else if(thizz.name == "snoon" && thizz.value == ""){
         document.getElementById("shour").disabled = false;
         document.getElementById("sminute").disabled = false;
      }else if(thizz.name == "enoon" && thizz.value != ""){
         document.getElementById("ehour").disabled = true;
         document.getElementById("eminute").disabled = true;
      }else if(thizz.name == "enoon" && thizz.value == ""){
         document.getElementById("ehour").disabled = false;
         document.getElementById("eminute").disabled = false;
      }
   }
   
   function handleSubmit(){
      var rnt = false;
      var ck = document.getElementsByName("ldid");
      var countLD = "";
      var chld = "";
      var chldid = "";
      for(var i=0;i<ck.length;i++){
          if(ck[i].checked){
             createHidden("ldid_" + i,ck[i].value);
             createHidden("ldname_" + i,ck[i].getAttribute("iname"));
             chld += ck[i].getAttribute("iname") + ",";
             chldid += ck[i].value + ",";
             countLD += i + ",";
             rnt = true;
          }
      }
      
      if(!rnt){
         alert("请选择与会领导");
      }else if(isblank(document.form1.stime) || isblank(document.form1.etime)){
         alert("请设置开始时间或结束时间");
      }else if(isblank(document.form1.zbdwname)){
         alert("请选择主办单位");
      }else if(isblank(document.form1.fbid)){
         alert("请设置发布范围");
      }else if(confirm("确定提交")){
          var stime = parseDate(document.form1.stime.value);

	      if(document.form1.snoon.value == ""){
	         stime += document.form1.shour.value + "" + document.form1.sminute.value;
	      }else{
	         stime += document.form1.snoon.value;
	      }
	      
	      var etime = parseDate(document.form1.etime.value);

	      if(document.form1.enoon.value == ""){
	         etime += document.form1.ehour.value + "" + document.form1.eminute.value;
	      }else{
	         etime += document.form1.enoon.value;
	      }
	      
	      createHidden("sdate",stime);
	      createHidden("edate",etime);
	      
	      var fbids = document.form1.fbid.value.split(",");
	      var fbnames = document.form1.fbname.value.split(",");
	      
	      var countFB = "";
	      
	      for(var i=0;i<fbids.length;i++){ 
	          createHidden("fbid_" + i,fbids[i]);
	          createHidden("fbname_" + i,fbnames[i]);
	          createHidden("fbtype_" + i,"g");
	          countFB += i + ",";
	      }
	      
	      createHidden("countFB",countFB);
	      
	      createHidden("countLD",countLD);

	      createHidden("chld",chld.substring(0,chld.length-1));
	      createHidden("chldid",chldid.substring(0,chldid.length-1));
	      
	      document.form1.action = context + "/app/ldrc.do?method=update";
	      document.form1.submit();
      }
   }
</script>
<body>
<form id="form1" name="form1" method="post" action=""><input type="hidden"
	name="id" value="<%=ldrc.id()%>">
<fieldset id="lanmu" style="width:800px;margin:15px;">
<legend>领导日程详情</legend>
<table width="600" class="tab4edit" align="center">
	<tr>
		<td colspan="2" align="right"><a href="javascript:void(0);" onclick="javascript:void(-1);"
			onclick="javascript:doPrint();">打印</a></td>
	</tr>
	<tr>
		<td class="td1" width="100" valign="top">出席领导&nbsp;</td>
		<td>&nbsp;<%=ldrc.ichld()%></td>
	</tr>
	<tr>
		<td class="td1">时间安排</td>
		<td>&nbsp;开始时间: <%=DateTrimmer.getYMD_LBL(ldrc.isdate())%> <%=!ldrc.isnoon().equals("") ? (noonquery.query(ldrc
					.isnoon()).getName()) : ""%> <%=ldrc.isnoon().equals("") ? ldrc.ishour() + "点" : ""%>
		<%=ldrc.isnoon().equals("") ? ldrc.isminute() + "分"
					: ""%> 结束时间: <%=DateTrimmer.getYMD_LBL(ldrc.isdate())%> <%=!ldrc.isnoon().equals("") ? (noonquery.query(ldrc
					.isnoon()).getName()) : ""%> <%=ldrc.ienoon().equals("") ? ldrc.iehour() + "点" : ""%>
		<%=ldrc.ienoon().equals("") ? ldrc.ieminute() + "分"
					: ""%></td>
	</tr>
	<tr>
		<td class="td1">主办单位</td>
		<td>&nbsp;<%=ldrc.izbdw()%></td>
	</tr>
	<tr>
		<td class="td1">活动地点</td>
		<td>&nbsp;<%=ldrc.ihddd()%></td>
	</tr>
	<tr>
		<td class="td1" valign="top">活动内容</td>
		<td>&nbsp;<%=ldrc.ihdnr()%></td>
	</tr>
	<tr>
		<td class="td1">陪同人员</td>
		<td>&nbsp;<%=ldrc.iptry()%></td>
	</tr>
	<tr>
		<td class="td1" valign="top">说明</td>
		<td>&nbsp;<%=ldrc.ism()%></td>
	</tr>
	<tr>
		<td class="td1">登记人</td>
		<td>&nbsp;<%=ldrc.idjrname()%></td>
	</tr>
	<tr>
		<td class="td1">登记时间</td>
		<td>&nbsp;<%=DateTrimmer.getYMD_LBL(ldrc.idjdate())%></td>
	</tr>
	<tr>
		<td class="td1" valign="top">备注</td>
		<td>&nbsp;<%=ldrc.ibz()%></td>
	</tr>
	<tr>
		<td class="td1">发布范围</td>
		<td>&nbsp;<%=ldrc.ifbname()%></td>
	</tr>
</table>
</fieldset>
</form>
</body>
</html>
